<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
index
</body>
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="js/sockjs.min.js"></script>
<script src="js/stomp.js"></script>

<script type="text/javascript">
  const sock = new SockJS("http://localhost:8080/ws");
  const stompClient = Stomp.over(sock);
  stompClient.connect({}, (frame) => {
    console.log('websocket连接成功:' + frame);
    // 另外再注册一下消息推送
    stompClient.subscribe("/user/1/message", (response) => {
      console.log("/user/1/message");
      server = JSON.parse(response.body);
      console.log(server);
    });
  });
</script>
</html>